<template>
	<view>
		<view class="recharge_con" v-if="list.length>0">
			<view class="con" v-for="(item,index) in list" :key="index">
				<label v-if="item.mi_type==0">{{item.mi_bewrite}}<em>+{{item.mi_value}}</em></label>
				<label v-else>{{item.mi_bewrite}}<em class="buy">-{{item.mi_value}}</em></label>
				<i>{{item.mi_setTime}}</i>
			</view>
		</view>
		<!--空信息-->
		<view class="nodata_con" v-else-if="isLoading==false">
			<label class="iconfont icon-meiyoushuju"></label>
			<text>{{$t('no_data')}}</text>
		</view>
		<!--刷新-->
		<view class='loadind_con' v-if="isLoading">
			<view class="loading">
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
				<view class="loading-bar"></view>
			</view>
		</view>
	</view>
</template>

<script>
	import valid from '@/static/valid.js';

	export default {
		data() {
			return {
				index: 1, //页数
				size: 10, //条数
				list: [], //列表值
				isLoading: true, //是否正在加载
			}
		},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t('integral')
			})
		},
		onLoad() {
			var _this = this;
			//加载列表
			_this.getData();
		},
		onPullDownRefresh() { //下拉刷新
			var _this = this;
			//清空还原
			_this.index = 1;
			_this.list = [];
			_this.isLoading = true;
			_this.getData();
		},
		onReachBottom() { //上拉到底部刷新
			var _this = this;
			_this.index = _this.index + 1;
			_this.isLoading = true;
			_this.getData();
		},
		methods: {
			getData: function() { //获取内容
				var _this = this;
				_this.fun_request("/Api/MemberIntegral/GetPageList", {
					index: _this.index,
					size: _this.size,
					count: 0
				}, function(res) {
					var _list = res.data;
					_this.list = _this.list.concat(_list);
					//加载完成
					_this.isLoading = false;
					//下拉刷新 - 停止
					uni.stopPullDownRefresh();
				});
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #F7F7F7;
	}

	.recharge_con {
		width: 94%;
		margin: 30rpx 3%;

		view.con {
			margin-bottom: 30rpx;
			background-color: #fff;
			border-radius: 15rpx;
			padding: 30rpx 3%;

			label {
				display: block;
				font-size: 32rpx;
				font-weight: bold;
			}

			em {
				float: right;
				padding: 0;
				margin: 0;
				color: #9F6DFA;
				font-size: 30rpx;
				font-weight: normal;
				font-style: normal;
			}

			em.buy {
				color: #F85F69;
			}

			i {
				display: block;
				color: #999;
				padding: 0;
				margin: 15rpx 0 0 0;
				font-size: 28rpx;
				font-style: normal;
			}
		}
	}
</style>
